// 题目链接：https://leetcode.cn/problems/valid-perfect-square/

class Solution
{
public:
    bool isPerfectSquare(int num)
    {
        long long l = 0, r = num;
        long long mid;
        while (l + 1 < r)
        {
            mid = (l + r) / 2;
            if (mid * mid < num)
                l = mid;
            else
                r = mid;
        }
        if (r * r == num)
            return true;
        else
            return false;
    }
};